package com.changgou.listener;

import com.changgou.dao.ESDao;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: changgou_parent
 * @author: zhanzhewan
 * @create: 2020-03-27 19:29
 **/

@Component
@RabbitListener(queues = "goods_down_queue")
public class GoodsDownListener {

    @Autowired
    private ESDao esDao;

    @RabbitHandler
    public void rabbitHandle(String SpuId){
        System.out.println(SpuId);
        Long aLong = Long.valueOf(SpuId);
        esDao.deleteById(aLong);
    }
}
